<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" type="text/css" href="js/layer/css/layui.css">
    <link rel="stylesheet" type="text/css" href="css/admin.css">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <script>
        var searchFieldNum = 0;
    </script>
    <style>


    </style>
</head>

<body>
<div class="container-fluid-table" id="view">

    <div class="row">

        <div class="col-lg-12">
            <div class="card">
                <header class="card-header">
                    <div class="card-title" style="float: left; line-height: 2.4em;" onclick="javascript:window.location.reload();">{{d.title}}</div>
                    <div class="card-search">
                        {{#  if(d.search == true){ }}
                        <form class="search-bar1 ml-md-auto1" method="post" onsubmit="return laysearch(this);"  style="float: right;">
                            <select name="field" id="search-field" class="custom-select" style="max-width: 110px!important;text-align: center;">
                                {{#  arr_foreach(d.cols, function(k1, v1){ }}
                                {{#  if(v1.search === true || searchFieldNum == 0){ }}
                                <option value="{{v1.field}}">{{v1.title}}</option>
                                {{#  } }}
                                {{searchFieldNum++}}
                                {{#  }); }}
                            </select>
                            <input id="search-val" type="text" style="width: 130px;" name="keyword" placeholder="请输入搜索内容">
                            <div class="layui-btn-group">

                                <button type="submit" class="layui-btn layui-btn-primary layui-btn-sm">搜索</button>
                                <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" onclick="advancedSearch()">高级</button>

                            </div>
                        </form>
                        {{#  } }}

                    </div>
                </header>

                <div class="layui-card1">

                    <div class="layui-tab layui-tab-brief" id="page-tab" lay-filter="test-hash" >
                        {{#  if(d.tabs.length){ }}
                        <ul class="layui-tab-title"  style="padding-left:0px;">
                            {{#  arr_foreach(d.tabs, function(k1, v1){ }}
                            {{#  if(k1 == 0){ }}
                            <li class="layui-this" onclick="tabsLink(this)" data-where='{{v1.where}}'>{{v1.title}}</li>
                            {{# }else{ }}
                            <li  onclick="tabsLink(this)" data-where='{{v1.where}}'>{{v1.title}}</li>
                            {{#  } }}
                            {{#  }); }}
                        </ul>
                        {{#  } }}
                    </div>
                    <div class="layui-tab-content" style="padding:0px;">
                        <table id="laytable" lay-filter="laytable"  style="boder:none;"></table>

                        <script id="left-toolbar" type="text/html">
                            <div class="layui-btn-container layui-btn-group">
                                {{#  arr_foreach(d.head_toolbar, function(k1, v1){ }}
                                {{#  if(v1.event != 'hidden'){ }}
                                <button data-config={{=json_encode(v1)}} class="layui-btn layui-btn-primary layui-btn-sm head-event" lay-event="header"><i class="layui-icon">{{-v1.ico}}</i>{{v1.title}}</button>
                                {{#  } }}
                                {{#  }); }}
                            </div>
                        </script>

                    </div>

                </div>


            </div>
        </div>

    </div>

</div>


<script type="text/javascript" src="js/layer/layui.js"></script>
<script>
    window.where = {};
    var tabWhere = [];
    window.zhanshop = null;
    ready(function() {
        layui.use(['zhanshopTable', 'zhanshop'], function() {
            zhanshop = layui.zhanshop;
            // view: function(url, elem, callback, reqMethod = 'POST', data = '', head = {}){
            zhanshop.view(API_ADDRESS + apiUrlTable +"/"+ zhanshop.getParam('_id'), '#view', function(
                data) {
                layui.zhanshopTable.url = API_ADDRESS + apiUrlTable +"/"+ zhanshop.getParam('_id');
                layui.zhanshopTable.title = data.title;
                layui.zhanshopTable.elem = '#laytable';
                layui.zhanshopTable.toolbar = '#left-toolbar';
                layui.zhanshopTable.rowbar = data.row_toolbar; // 配置行级别菜单
                /**/
                layui.zhanshopTable.width = data.width;
                layui.zhanshopTable.height = data.height;
                layui.zhanshopTable.even = data.even;
                layui.zhanshopTable.skin = data.skin;
                layui.zhanshopTable.css = data.css;
                layui.zhanshopTable.size = data.size;
                layui.zhanshopTable.limit = data.limit;
                layui.zhanshopTable.limits = data.limits;
                layui.zhanshopTable.page = data.page;
                layui.zhanshopTable.lineStyle = data.lineStyle;
                layui.zhanshopTable.cellMinWidth = data.cellMinWidth;
                layui.zhanshopTable.data = data.data;
                /**/
                layui.zhanshopTable.idName = data.pk;
                layui.zhanshopTable.titleName = data.title_name;
                layui.zhanshopTable.pidName = data.pid_name;
                layui.zhanshopTable.schma = data.cols;
                layui.zhanshopTable.searchPage = data.searchpage;
                window.colsData = [];
                if(data.cols_first){
                    colsData.push({type: data.cols_first});
                }
                for(var i in data.cols){
                    if(data.cols[i]['in_list'] !== false){
                        colsData.push(layui.zhanshopTable.laycols(data.cols[i]));
                    }
                }

                if(data.tabs != false){
                    $("#page-tab").css("display", "");
                }
                layui.zhanshopTable.render(colsData);

            }, 'POST', {"_method":"render"});
        });
    });
</script>
</body>
</html>
